Fix mobile LCP regression on cards library page: load Typekit font async#20
Merged
Conversation
Lighthouse traces (throttling-method=devtools) show the LCP regression on /docs/library/blocks/cards is not caused by the cards aspect-ratio change: the LCP breakdown shows ~4.5s of "resource load delay" before any block CSS/ JS/images even start fetching, because a render-blocking, cross-origin Typekit stylesheet (chained to a second p.typekit.net request) monopolizes network priority under mobile throttling. This link bypassed the existing async font-loading pattern already used for fonts.css. Moving it into loadFonts() lets it load as a progressive enhancement, same as the Roboto fallback fonts, cutting local devtools-throttled mobile LCP from 7.3s to 3.9s.
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
Commits
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/docs/library/blocks/cards(score 70, LCP 9.5-9.6s) using real Lighthouse traces (--throttling-method=devtools, matching actual CI conditions rather than simulated throttling).resourceLoadDelayalone was ~4.5-6s, before any block CSS/JS/image even started fetching. Byte size of the LCP image was already ruled out (confirmed ~14KB regardless of requested width).head.htmlloaded the Adobe Fonts (Typekit) stylesheet for the nav as a synchronous, render-blocking, cross-origin<link>(use.typekit.net/mvi1kov.css, chained to a secondp.typekit.net/p.cssrequest). Under mobile network throttling this monopolizes network priority/bandwidth for several seconds, delaying every subsequent block resource — including the true LCP image — regardless of what that image looks like. This link predates the cards redesign (added in the earlier nav rebuild) and bypassed the project's existing async font-loading pattern (loadFonts()inscripts/scripts.js, already used forfonts.css's Roboto fallback).<link>fromhead.htmland load the same stylesheet insideloadFonts()vialoadCSS(), so it loads as a progressive enhancement (Roboto fallback covers text until it swaps in), consistent with howfonts.cssis already loaded.livereload.jsinjection that won't exist on the deployed preview.Preview: https://fix-cards-mobile-lcp--hal--adobedevxsc.aem.page/docs/library/blocks/cards
Test plan
npm run lintpasseslighthouse --throttling-method=devtools --form-factor=mobile) before/after the fix🤖 Generated with Claude Code